<?php
class imagesComMod extends MY_Model{
	
	function imagesComMod(){
		parent::__construct(
			"comment_images",
			array(
				"id_images",
				"id_member",
				"comment",
				"posted",
			),
			array("id_images")
		);
	}
	
	function _generateID($str){
    	return md5($str);
    }
    
	/**
     * Insert data cuisine (menu makanan) baru. 
     * Contoh penggunaan:
     * </pre>
     * @param $newData (array) - array dari nama fields dan nilanya.
     */
    function Add($newData){
//    	$newData["id_images"] = $this->_generateID(md5($newData).time());
    	$newData["posted"] = date("Y-m-d H:m:s");
    	return $this->db->insert($this->table_name, $newData);
    }
    
    /**
     * value dari tiap primary key field.
     * Contoh :
     * <pre>
     * 		//value dari tiap primary key field
     * 		$data = array(
     * 			'[id 1]',  		// primary key 1
     * 			'[id 2]',  		// primary key 2
     * 		);
     * </pre>
     * @param $leafID (array) - value dari tiap primary fields
     */
    function remove($ids){
    	
    	if (!is_array($ids)) $ids = array($ids);
    	foreach($ids as $pk) {
    		$this->db->or_where("id_images", $pk);	
    	}
    	
    	return $this->db->delete($this->table_name, $pk);
    }
    
    /**
     * return cuisine (menu makanan) dengan id tertentu. 
     * @param $ids (array) - id facility 
     */
    function get($id){
    	return $this->db->get_where($this->table_name, array('id_images' => $id));
//		return $this->db->get($this->table_name, array("id_images"=>$id));
    }
	
}